package com.foreknow.elmboot.service.impl;

import com.foreknow.elmboot.mapper.DeliveryAddressMapper;
import com.foreknow.elmboot.po.DeliveryAddress;
import com.foreknow.elmboot.service.DeliveryAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeliveryAddressServiceImpl implements DeliveryAddressService {

    @Autowired
    private DeliveryAddressMapper deliveryAddressMapper;

    @Override
    public List<DeliveryAddress> readAddress(Integer userId) throws Exception {
        return deliveryAddressMapper.readAddress(userId);
    }

    @Override
    public DeliveryAddress getDeliveryAddressById(Integer daId) throws Exception {
        return deliveryAddressMapper.getDeliveryAddressById(daId);
    }

    @Override
    public int reviseDeliveryAddress(Integer daId, String contactName, Integer contactSex, String contactTel, String address, Integer userId) throws Exception {
        return deliveryAddressMapper.reviseDeliveryAddress(daId,contactName,contactSex,contactTel,address,userId);
    }

    @Override
    public int deleteDeliveryAddress(Integer daId) throws Exception {
        return deliveryAddressMapper.deleteDeliveryAddress(daId);
    }

    @Override
    public int saveDeliveryAddress(String contactName, Integer contactSex, String contactTel, String address, Integer userId) throws Exception {
        return deliveryAddressMapper.saveDeliveryAddress(contactName,contactSex,contactTel,address,userId);
    }
}
